package com.googlecode.connectlet.crypto.digest;

import java.security.MessageDigestSpi;

public final class MD5MessageDigest extends MessageDigestSpi {
	private MD5Stream stream = new MD5Stream();

	@Override
	protected byte[] engineDigest() {
		byte[] result = stream.digest();
		stream.reset();
		return result;
	}

	@Override
	protected void engineReset() {
		stream.reset();
	}

	@Override
	protected void engineUpdate(byte input) {
		stream.write(input);
	}

	@Override
	protected void engineUpdate(byte[] input, int offset, int len) {
		stream.write(input, offset, len);
	}
}